import { Injectable } from '@angular/core';

import { RouteModel } from '../models/index';

import { AuthService } from './auth.service';

@Injectable({
  providedIn: 'root'
})
export class RouteService {

  constructor(
    private authService: AuthService
  ) { }

  getmenu(): Array<RouteModel> {

    const role = this.authService.getRole();
    if (role) {
      if (role === 'Admin')  {
        const plan = new RouteModel('plan', null, 'payment.plan', 1, null);
        const payment = new RouteModel('payment', null, 'payment.payment', 2, null);
        const bill = new RouteModel('bill', null, 'payment.bill', 3, null);
        return [new RouteModel('payment', 'file', 'payment', 1, [plan, payment, bill])];
      } else {
        return [];
      }
    } else {
      return [];
    }

  }
}
